package com.haofengsoft.scce.db.biz.consultation;

import java.util.List;

import android.content.Context;

import com.haofengsoft.scce.ManageApplication;
import com.haofengsoft.scce.db.DaoSession;
import com.haofengsoft.scce.db.dao.StoneGoldDao;
import com.haofengsoft.scce.db.entity.consultation.StoneGold;

import de.greenrobot.dao.query.QueryBuilder;

/**
 * Created by admin on 2015/7/23.
 */
public class StoneGoldBiz {
	private static StoneGoldBiz instance;
	private static Context appContext;
	private StoneGoldDao dao;

	private StoneGoldBiz() {
	}

	public static StoneGoldBiz getInstance(Context context) {
		if (instance == null) {
			instance = new StoneGoldBiz();
			if (appContext == null) {
				appContext = context.getApplicationContext();
			}
			DaoSession daoSession = ManageApplication.getDaoSession(context);
			instance.dao = daoSession.getStoneGoldDao();
		}
		return instance;
	}

	public void insertStoneGoldList(final List<StoneGold> infoList) {
		dao.insertOrReplaceInTx(infoList);
	}

	public List<StoneGold> gainStoneGoldList() {
		QueryBuilder qb = dao.queryBuilder();
		return qb.list();
	}
}
